字串小幫手 on linux


Posted by Rich on 2021-08-10

grep

grep 是把資料裡面有我們要的關鍵字那整行取下來。

  • grep 的幾個指令:
    • -a:將 binary 以 text 檔案的方式進行搜尋
    • -c:計算找到‘搜尋字串’的次數
    • -i:忽略大小寫差異
    • -n:輸出行號
    • -v:輸出沒有‘搜尋字串’的資料
    • --color=auto:幫文字上色

grep 'rich' 把有“rich"的行全部取下來。
grep -v 'rich' 把沒有“rich"的行全部取下來。
搭配正規表示法,才能真正發揮 grep 的實力。


#筆記







Related Posts

Day2 android UI實作+activity介紹!!

Day2 android UI實作+activity介紹!!

Print a list from 1 times 1 to 9 times 9

Print a list from 1 times 1 to 9 times 9

[程式挑戰] 全域變數和區域變數可視範圍 Variable Scope

[程式挑戰] 全域變數和區域變數可視範圍 Variable Scope


Comments